﻿		<script type="text/javascript" src="/js/change.js" language="javascript" ></script>
		<?php if(isset($_GET["type"]) && $_GET["type"]==3) {?>
		
			<!-- minh if else muti layout trong day-->
			<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
			<link rel="stylesheet" type="text/css" href="/css/insertQA.css" />
			<div id="pageindex">
				<div class="divleft" style="clear:both; float:left;">
					<p class="titleqa"><?php if(isset($cate_info)&&(count($cate_info)>0)){echo $cate_name;}else{?><?php echo $latestqa; }?></p>
					<?php if(isset($permission) && $permission=="true") {?>
					<?php if(isset($categoryleaf)) {?>
						<ul class="gallery clearfix">
							<a href="/listshow/insertqa?cate=<?php echo $_GET["category"];?>&iframe=true&width=600&height=530" rel="prettyPhoto[iframe]" id="askquestion"><img src="/images/button_add.png" alt=""/></a>
						</ul>
					<?php } }?>
				</div>
				<?php if(isset($permission) && $permission=="true") {?>
				<div class="divright" style="float:left;">
					<span class="titlets"><?php echo $show ?></span>
					<input class="btn_change_type_show" type="button" onclick="change_type_show(1)" style="background-image: url('/images/<?php if($_GET["show"]==1) {?>icon_view_list_on.gif<?php } else {?>icon_view_list_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(3)" style="background-image: url('/images/<?php if($_GET["show"]==3) {?>icon_view_thumbnail_on.gif<?php } else {?>icon_view_thumbnail_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(2)" style="background-image: url('/images/<?php if($_GET["show"]==2) {?>icon_view_collapse_on.gif<?php } else {?>icon_view_collapse_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
				</div>
				<?php }?>
			</div>
			
			<?php } else { if($_SESSION['config_template']=='layoutmain_web1'){ ?>
			
					<div class="toolbar">

							<div class="sorter">
								<p class="view-mode">
									<label><?php echo $show ?></label>
									<!--
										<a href="/qa/switchtypeshow?typeshow=1&category=<?php //echo $_GET["category"];?>">Grid</a>
										<a href="/qa/switchtypeshow?typeshow=3&category=<?php //echo $_GET["category"];?>">Thumb</a>
										<a href="/qa/switchtypeshow?typeshow=2&category=<?php //echo $_GET["category"];?>">Short</a>
									-->
									<a href="#" onclick="change_type_show(1)">Grid</a>
									<a href="#" onclick="change_type_show(3)">Thumb</a>
									<a href="#" onclick="change_type_show(2)">Short</a>
								</p>
							</div>
			</div>
			<?php }else{?>
			<link rel="stylesheet" type="text/css" href="/css/insertQA.css" />
			<div id="pageindex">
				<div class="divleft">
					<p class="titleqa"><?php if(isset($cate_info)&&(count($cate_info)>0)){echo $cate_name;}else{?><?php echo $latestqa; }?></p>
					<?php if(isset($permission) && $permission=="true") {?>
					<?php if(isset($categoryleaf)) {?>
						<ul class="gallery clearfix">
							<a href="/listshow/insertqa?cate=<?php echo $_GET["category"];?>&iframe=true&width=600&height=530" rel="prettyPhoto[iframe]" id="askquestion"><img src="/images/button_add.png" alt=""/></a>
						</ul>
					<?php } }?>
				</div>
				<?php if(isset($permission) && $permission=="true") {?>
				<div class="divright">
					<span class="titlets"><?php echo $show ?></span>
					<input class="btn_change_type_show" type="button" onclick="change_type_show(1)" style="background-image: url('/images/<?php if($_GET["show"]==1) {?>icon_view_list_on.gif<?php } else {?>icon_view_list_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(3)" style="background-image: url('/images/<?php if($_GET["show"]==3) {?>icon_view_thumbnail_on.gif<?php } else {?>icon_view_thumbnail_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(2)" style="background-image: url('/images/<?php if($_GET["show"]==2) {?>icon_view_collapse_on.gif<?php } else {?>icon_view_collapse_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
				</div>
				<?php }?>
			</div>
			<?php }} ?>
			<script type="text/javascript">
			function change_type_show(type)
			{
				if (window.XMLHttpRequest)
				{// code for IE7+, Firefox, Chrome, Opera, Safari
					xmlhttp=new XMLHttpRequest();
				}
				else
				{// code for IE6, IE5
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange = function()
				{	
					if (xmlhttp.readyState==4 && xmlhttp.status==200)
					{
						if(xmlhttp.responseText==-1)
							alert("Error! Can not change type show.");
						else
							window.top.location.reload();
					}
				};
				var url = "/qa/switchtypeshow?typeshow="+type;
				xmlhttp.open("GET",url,true);	
				xmlhttp.send();
				return false;
			}
			</script>
			
			<!-- minh if else muti layout trong day-->
		<?php } ?>
		<?php if(isset($_GET["type"]) && $_GET["type"]==2) {?>
		<!-- minh if else muti layout trong day-->
			<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
			<div id="pageindex">
				<link rel="stylesheet" type="text/css" href="/css/insertQA.css" />
				<div class="divleft" style="float:left;">
					<p class="titleqa"><?php if(isset($cate_info)&&(count($cate_info)>0)){echo $cate_name;}else{?><?php echo $latestnews; ?> <?php }?></p>
					<?php if(isset($permission) && $permission=="true") {?>
					<?php if(isset($categoryleaf)) {?>
							<a href = "javascript:;" onclick ="popUnder('/news/post?cate=<?php echo $_GET["category"];?>')" id="post_product" ><img src="/images/button_add.png" alt=""/></a>
					<?php }} ?>
				</div>
				<?php if(isset($permission) && $permission=="true") {?>
				<div class="divright" style="float:left">
					<span class="titlets"><?php echo $show ?></span>
					<input class="btn_change_type_show" type="button" onclick="change_type_show(1)" style="background-image: url('/images/<?php if($_GET["show"]==1) {?>icon_view_list_on.gif<?php } else {?>icon_view_list_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(3)" style="background-image: url('/images/<?php if($_GET["show"]==3) {?>icon_view_thumbnail_on.gif<?php } else {?>icon_view_thumbnail_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(2)" style="background-image: url('/images/<?php if($_GET["show"]==2) {?>icon_view_collapse_on.gif<?php } else {?>icon_view_collapse_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
				</div>
				<?php }?>
			</div>
			
			<?php } else { if($_SESSION['config_template']=='layoutmain_web1'){ ?>
			
					<div class="toolbar">

							<div class="sorter">
								<p class="view-mode">
									<label><?php echo $show ?></label>
										<a href="#" onclick="change_type_show(1)">Grid</a>
										<a href="#" onclick="change_type_show(3)">Thumb</a>
										<a href="#" onclick="change_type_show(2)">Short</a>
								</p>
							</div>
			</div>
			<?php }else{?>?>
			<div id="pageindex">
				<link rel="stylesheet" type="text/css" href="/css/insertQA.css" />
				<div class="divleft">
					<p class="titleqa"><?php if(isset($cate_info)&&(count($cate_info)>0)){echo $cate_name;}else{?><?php echo $latestnews; ?> <?php }?></p>
					<?php if(isset($permission) && $permission=="true") {?>
					<?php if(isset($categoryleaf)) {?>
							<a href = "javascript:;" onclick ="popUnder('/news/post?cate=<?php echo $_GET["category"];?>')" id="post_product" ><img src="/images/button_add.png" alt=""/></a>
					<?php }} ?>
				</div>
				<?php if(isset($permission) && $permission=="true") {?>
				<div class="divright">
					<span class="titlets"><?php echo $show ?></span>
					<input class="btn_change_type_show" type="button" onclick="change_type_show(1)" style="background-image: url('/images/<?php if($_GET["show"]==1) {?>icon_view_list_on.gif<?php } else {?>icon_view_list_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(3)" style="background-image: url('/images/<?php if($_GET["show"]==3) {?>icon_view_thumbnail_on.gif<?php } else {?>icon_view_thumbnail_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="change_type_show(2)" style="background-image: url('/images/<?php if($_GET["show"]==2) {?>icon_view_collapse_on.gif<?php } else {?>icon_view_collapse_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
				</div>
				<?php }?>
			</div>
			<?php }}?>
			<script type="text/javascript">
			function change_type_show(type)
			{
				if (window.XMLHttpRequest)
				{// code for IE7+, Firefox, Chrome, Opera, Safari
					xmlhttp=new XMLHttpRequest();
				}
				else
				{// code for IE6, IE5
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange = function()
				{	
					if (xmlhttp.readyState==4 && xmlhttp.status==200)
					{
						if(xmlhttp.responseText==-1)
							alert("Error! Can not change type show.");
						else
							window.top.location.reload();
					}
				};
				var url = "/news/switchtypeshow?typeshow="+type;
				xmlhttp.open("GET",url,true);	
				xmlhttp.send();
				return false;
			}
			</script>
			
			<!-- minh if else muti layout trong day-->
		<?php } ?>
		<?php if(isset($_GET["type"]) && $_GET["type"]==1) {?>
		
		<!-- minh if else muti layout trong day-->
		<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
			<link rel="stylesheet" type="text/css" href="/css/insertQA.css" />
			<div id="pageindex">
				<div class="divleft"  style="float:left;">
					<p class="titleqa"><?php if(isset($cate_info)&&(count($cate_info)>0)){echo $cate_name;}else{?><?php echo $latestproduct?> <?php }?></p>
					<?php if(isset($permission) && $permission=="true") {?>
					<?php if(isset($categoryleaf)) {?>
						<ul class="gallery clearfix">
							<a href="/index/post?cate=<?php echo $_GET["category"];?>&iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="post_product" ><img src="/images/button_add.png" alt=""/></a>
						</ul>
					<?php }} ?>
				</div>
				<?php if(isset($permission) && $permission=="true") {?>
				<div class="divright" style="float:left;">
					<span class="titlets"><?php echo $show ?></span>
					<a href="/index/switchtypeshow?typeshow=1&category=<?php echo $_GET["category"];?>"><img src="/images/<?php if($_GET["show"]==1) {?>icon_view_list_on.gif<?php } else {?>icon_view_list_off.gif<?php }?>" alt=""/></a>
					<a href="/index/switchtypeshow?typeshow=3&category=<?php echo $_GET["category"];?>"><img src="/images/<?php if($_GET["show"]==3) {?>icon_view_thumbnail_on.gif<?php } else {?>icon_view_thumbnail_off.gif<?php }?>" alt=""/></a>
					<a href="/index/switchtypeshow?typeshow=2&category=<?php echo $_GET["category"];?>"><img src="/images/<?php if($_GET["show"]==2) {?>icon_view_collapse_on.gif<?php } else {?>icon_view_collapse_off.gif<?php }?>" alt=""/></a>
				</div>
				<?php }?>
			</div>
			
		<?php } else { if($_SESSION['config_template']=='layoutmain_web1'){ ?>
			
			<div class="toolbar">

							<div class="sorter">
								<p class="view-mode">
									<label><?php echo $show ?></label>
										<a href="/index/switchtypeshow?typeshow=1&category=<?php echo $_GET["category"];?>">Grid</a>
										<a href="/index/switchtypeshow?typeshow=3&category=<?php echo $_GET["category"];?>">Thumb</a>
										<a href="/index/switchtypeshow?typeshow=2&category=<?php echo $_GET["category"];?>">Short</a>
								</p>
							</div>
			</div>
			<?php }else{?>
			<link rel="stylesheet" type="text/css" href="/css/insertQA.css" />
			<div id="pageindex">
				<div class="divleft">
					<p class="titleqa"><?php if(isset($cate_info)&&(count($cate_info)>0)){echo $cate_name;}else{?><?php echo $latestproduct?> <?php }?></p>
					<?php if(isset($permission) && $permission=="true") {?>
					<?php if(isset($categoryleaf)) {?>
						<ul class="gallery clearfix">
							<a href="/index/post?cate=<?php echo $_GET["category"];?>&iframe=true&width=800&height=600" rel="prettyPhoto[iframe]" id="post_product" ><img src="/images/button_add.png" alt=""/></a>
						</ul>
					<?php }} ?>
				</div>
				<?php if(isset($permission) && $permission=="true") {?>
				<div class="divright">
					<span class="titlets"><?php echo $show ?></span>
					<a href="/index/switchtypeshow?typeshow=1&category=<?php echo $_GET["category"];?>"><img src="/images/<?php if($_GET["show"]==1) {?>icon_view_list_on.gif<?php } else {?>icon_view_list_off.gif<?php }?>" alt=""/></a>
					<a href="/index/switchtypeshow?typeshow=3&category=<?php echo $_GET["category"];?>"><img src="/images/<?php if($_GET["show"]==3) {?>icon_view_thumbnail_on.gif<?php } else {?>icon_view_thumbnail_off.gif<?php }?>" alt=""/></a>
					<a href="/index/switchtypeshow?typeshow=2&category=<?php echo $_GET["category"];?>"><img src="/images/<?php if($_GET["show"]==2) {?>icon_view_collapse_on.gif<?php } else {?>icon_view_collapse_off.gif<?php }?>" alt=""/></a>
				</div>
				<?php }?>
			</div>
		<?php }}?>
			<!-- minh if else muti layout trong day-->
		<?php } ?>
 		<?php 
		//echo $message;//test
		if(isset($_GET["show"]) && $_GET["show"]==1) // show dang detail  
		{ ?>
		<!-- minh if else muti layout trong day-->
		<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
		<div style="clear:both;"></div>
		<div class="listing-type-list catalog-listing">
			<?php 	if(isset($Products)){ ?>
			<?php foreach ($Products as $product) { ?>
			<div class="listing-item">
				<div class="product-image">
					<a title="" href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>">
						<img height="135" width="135" title="<?php echo $product["title"] ?>" alt="<?php echo $product["title"] ?>" src="<?php echo $product["avatar"] ?>">
					</a>
				</div>

				<div class="product-shop">
					<h5><a title="<?php echo $product["title"] ?>" href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $product["title"] ?></a></h5>
														
					<div class="price-box">
						<span id="product-price-16" class="regular-price">
							<strong><?php echo $price ?> </strong><span class="price"><?php echo number_format($product["price"]) ?> VNĐ</span>
						</span>
								
					</div>

					<div class="clear"></div>
					<div class="description">
						<?php echo $product["short_description"] ?>
					</div>
					<p class="add-to">
						<a class="link-cart" href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $btndetail ?></a>
						<span class="pipe">|</span>
						<a href="#" onclick="addCart(<?php echo $product["thing_id"] ?>)"><?php echo $btnadd ?></a>
					</p>
				</div>
			</div>
			<?php 			} 
					}
					else
					{ 
						if(isset($News))
						{?>
							
						<?php foreach ($News as $news) { 
			?>
			<div class="listing-item">
				<div class="product-image">
					<a title="" href="/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>">
						<img height="135" width="135" title="<?php echo $news["title"] ?>" alt="<?php echo $news["title"] ?>" src="<?php echo $news["avatar"] ?>">
					</a>
				</div>

				<div class="product-shop">
					<h5><a title="<?php echo $news["title"] ?>" href="/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>"><?php echo $news["title"] ?></a></h5>
														
					<div class="price-box">
						<span id="product-price-16" class="regular-price">
							<strong><?php echo $news['update_date'] ?></span>
						</span>
								
					</div>

					<div class="clear"></div>
					<div class="description">
						<?php echo $news["short_description"] ?>
						...
						<a href="/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>"><small><?php echo $detail ?></small></a>
					</div>
				</div>
			</div>
			<?php				
							}
							}
							else{
						
				?>
				<p style="clear:both;float:left; margin-left:15px;margin-top:15px;"><?php echo $nothing ?></p>
				<?php 
						}
							}?>
				
				
			
			<p class="txtli"><?php echo $pagination; ?></p>
		</div>
		<?php } else { if($_SESSION['config_template']=='layoutmain_web1') { ?>
		
				<?php 	if(isset($Products)){ 
						foreach ($Products as $product) {
					?>
					<div class="listing-type-list catalog-listing">
							<div class="listing-item">
								<div class="product-image">
									<a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" title="">
										<img src="<?php echo $product["avatar"] ?>" style="max-width: 96px; max-height: 96px;" >
									</a>
								</div>

								<div class="product-shop" style="width:80%">
									<h5><a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" title="<?php echo $product["title"] ?>"><?php echo $product["title"] ?></a></h5>
									<div class="price-box">
										<span class="regular-price" id="product-price-51">
											<span class="price"><?php echo number_format($product["price"]); ?> VNĐ</span>                
										</span>
												
									</div>

									<button class="form-button" onclick="addCart(<?php echo $product["thing_id"] ?>)"><span><?php echo $btnadd ?></span></button>
									<div class="clear"></div>
									<div class="description">
										<?php echo $product["short_description"] ?>     <a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" title=""><small><?php echo $detail ?></small></a>        
									</div>
								</div>
							</div>

						</div>
						<?php }} else { if(isset($News))
										{?>
										<?php foreach ($News as $news) { 
							?>
								
								<div class="listing-type-list catalog-listing">
								<div class="listing-item">
								<div class="product-image">
									<a href="/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>" title="">
										<img src="<?php echo $news["avatar"] ?>" alt="<?php echo $news["title"] ?>" title="title" style="max-width: 96px; max-height: 96px;">
									</a>
								</div>

								<div class="product-shop" style="width:80%">
									<h5><a href="/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>" title="<?php echo $news["title"] ?>"><?php echo $news["title"] ?></a></h5>
									
									<div class="clear"></div>
									<br/>
									<div class="p_content">
										<span class="date"><?php echo $news['update_date'] ?> </span>
									</div>
									<div class="description" style="color:black">
										<?php echo $news['short-description'] ?>   
									</div>
									<button type="button" name="btnDetails" value="Detail" class="special_button floatright" onclick="document.location.href='/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>'" >
											<span><?php echo $detail ?></span>
									</button>	
								</div>
							</div>
					

						</div>
									
						<?php }}else{ ?>
							
						<p style="clear:both;float:left; margin-left:15px;margin-top:15px;"><?php echo $nothing ?></p>
					<?php  }}?>
					<p class="txtli"><?php echo $pagination; ?></p>
		<?php } else {?>
		<link rel="stylesheet" type="text/css" href="/css/product_detail_show.css" />
		<script type="text/javascript" src="/js/jquery_elastic.js" language="javascript" ></script>
			
				<div class="detailProductShow">
							<?php 	if(isset($Products)){ ?>
								<h2></h2>
				
							<?php foreach ($Products as $product) { ?>
							
							<div class="form">
								<div class="picture" style="height:200px;">
									<img src="<?php echo $product["avatar"] ?>" style="max-width:250px; max-height:150px; margin-top:25px;">
																		
								</div>
								<div class="content">
									<h2 style="margin-top:25px;font-size:20px;"><a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" ><?php echo $product["title"] ?></a></h2>
									<p style="margin-top:10px;"><?php echo $update ?> <?php echo $product['update_date'] ?></p>
									<p style="clear:both;"><?php echo $product["short_description"] ?></p>
									<br/>
									<p style="clear:both;"><b><font color= "red"><?php echo $price ?> <?php echo number_format($product["price"]); ?> VNĐ</font></b></p>
									<input type="button" name="btnDetails" style="clear:both;background-image: url('../images/but_details2.png');color:white; border: none;text-align: center;float: left;margin-top:10px;margin-left:10px;" value="<?php echo $btndetail ?>" class="btnDetail" onclick="document.location.href='/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>'" <?php if($type!=1){?>style="margin-left: 50px;"<?php }?>/>
									<input type="button" name="Add" style="background-image: url('../images/but_addtocart2.png');color:white; border: none;text-align: center;padding:0px;float: left;margin-top:10px;margin-left:10px;" value="<?php echo $btnadd ?>" class="Add" onclick="addCart(<?php echo $product["thing_id"] ?>)" />
								</div>
							</div>
							<?php 			} 
									}
									else
									{ 
										if(isset($News))
										{?>
											
										<?php foreach ($News as $news) { 
							?>
								
									<div class="picture2">
								<div class="picture_top2">
								</div>
								<div class="picture_content2">
								</div>
								<div class="picture_bottom2">
								</div>
								<img src="<?php echo $news["avatar"] ?>" width="180" height="130" alt="" class="imgpf2" style="max-width:230px; max-height:150px"/>
						
								<div class="contentnews2">
									<a href="/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>"><h2><?php echo $news["title"] ?></h2></a><br style="line-height: 10px;"/>
									<p><?php echo $news["short_description"] ?> ...
									<a href="/<?php echo $route;?>/detail?id=<?php echo $news["thing_id"] ?>"><?php echo $detail ?></a></p>
									<p style="margin-left: 200px;"><?php echo $news['update_date'] ?></p>
								</div>
							</div>
							<?php				
										}
										}
										else{
									
							?>
							<p style="clear:both;float:left; margin-left:15px;margin-top:15px;"><?php echo $nothing ?></p>
							<?php 
									}
										}?>
							
							
						
						<p class="txtli"><?php echo $pagination; ?></p>
				</div>
		<?php }} ?>
					<!-- minh if else muti layout trong day-->
		<?php } 
		/////////////////////////////////////////////////////////////////////////
		//                                                                     //
		/////////////////////////////////////////////////////////////////////////
		
		else if(isset($_GET["show"]) && $_GET["show"]==2) // show dang short
		{ ?>
		
		<!-- minh if else muti layout trong day-->
			
				
						
						<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
						<div id="main" class="col-main">
							<div id="shortshow" style="width:100%;height:auto; margin-left:15px;margin-top:0px;">
							<?php  		
								if(isset($Products)){									
								foreach ($Products as $product)
								{							
							?>										
								<div id="show_img" style="float:left;margin-top:16px;margin-right:5px;width:25px;height:20px">	<a href="#"><img src="/images/plus-button.png" alt="" /></a></div>
								<div id="topic" style="float:left;margin-top:8px;margin-bottom:8px;width:90%;padding: 8px 8px 8px 8px;font-size:13px;font-weight: bold;font-family:Arial, Helvetica, sans-serif;">
									<a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $product["title"] ?> ...</a>
									<p style="float:right;font-size:10px"> <?php echo $product['update_date'] ?> </p>
								</div>
							<?php }} else  echo "Not available"; ?>
							</div>
						</div>
						
						<?php } else {?>
							<div id="main" class="col-main">
				 				<div id="shortshow" style="width:100%;height:auto; clear:both;">
				 				<?php  		
								if(isset($Products)){									
								foreach ($Products as $product)
								{							
							?>	
									<div id="show_img" style="float:left;margin-top:16px;width:30px;height:20px">	<img src="/images/plus-button.png" alt="" /></div>
									<div id="topic" style="float:left;margin-top:8px;margin-bottom:8px;width:90%;padding: 8px 8px 8px 8px;font-size:13px;font-weight: bold;font-family:Arial, Helvetica, sans-serif;">
										<a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $product["title"] ?> ...</a>
										<p style="float:right;font-size:10px"> <?php echo $product['update_date'] ?> </p>
									</div>
								<?php }} else  echo "Not available"; ?>	
								</div>
							</div>
						<?php }?>
					
					
					
				 <div class="loadpage"><?php echo $pagination; ?></div>
				 <!-- minh if else muti layout trong day-->
		<?php }
		/////////////////////////////////////////////////////////////////////////
		//                                                                     //
		/////////////////////////////////////////////////////////////////////////
		else // show dang thumb
		{ ?>
		<!-- minh if else muti layout trong day-->
		<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
			<div style="clear:both;"></div>
			<link rel="stylesheet" type="text/css" href="/css/tooltip.css" />
			<script type="text/javascript" src="/js/jquery_elastic.js" language="javascript" ></script>
			<script type="text/javascript" src="/js/tooltip.js" language="javascript" ></script>
					<div style="clear:both;text-align:center;font-size:12px;color:red"><?php echo $errorMessage;?></div>
			<div class="listing-type-grid catalog-listing">
				<?php  
				$count=0;
				if($getthings!=null)
				{
				foreach ($getthings as $product)
				{
					$count++;
					if($count==1)
						echo "<ol class='grid-row'>";
				?>
					<li class="item <?php if($count==4) echo "last"; ?>">
						<h5><a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('<?php echo $product["title"]?>')" onMouseout="hideddrivetip()"><?php echo $product["title"]?></a></h5>
						<p class="product-image">
								<a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('<?php echo $product["title"]?>')" onMouseout="hideddrivetip()">
									<img width="156" height="132" src="<?php echo $product['avatar']?>">
								</a>
						</p>
						<div class="price-box">
							<span id="product-price-16" class="regular-price">
						<?php if($type==1){?>
								<span class="price"><?php echo number_format($product["price"])?> VNĐ</span>
						<?php } ?>
							</span>		
						</div>
																			
						<div class="group_view">
							<p class="view_view" <?php if($type!=1){?>style="margin-left: 50px;"<?php }?> >
								<a style="width:auto" href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $btndetail ?></a>
							</p>
							<?php if($type==1){?>
							<p class="view_addto"> 
								<button onclick="addCart(<?php echo $product["thing_id"] ?>)" class="form-button" type="button"><span><?php echo $btnadd ?></span></button>
							</p>
							<?php } ?>
							<div class="clear"></div>
						</div>
					</li>
					<!-- tooltip product -->
                    <div id="<?php echo $product["title"]?>" class="tooltip">
                        <div id="t_p_name">
                            <h3 class="p_name"><?php echo $product["title"]?></h3>
                        </div>
                        <div id="t_p_date">
                            <span class="p_date"><b><?php echo $cdate ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["created_date"])?></span>
                        </div>
                        <div id="t_p_status">
                            <span class="p_update"><b><?php echo $update ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["update_date"])?></span>
                        </div>
                        <div id="t_p_price">
                            <span class="p_price"><?php if($type==1){?><b><?php echo $price ?> </b><?php echo number_format($product["price"])?> VNĐ &nbsp; &nbsp;<?php }?> (<b><?php echo $view ?></b> <?php echo $product["views"]?>)</span>
                        </div>
                        <div id="t_p_picture" >
                        	<img src="<?php echo $product['avatar']?>" alt="" class="t_p_avatar"/>
                        </div>
                        <div id="t_pt_short_description" >
                        	<span class="p_short_description"><?php echo nl2br($product['short_description'])?></span>
                        </div>
					</div>
                    <!-- end tooltip product -->
				<?php 
					if($count==4)
					{
						$count=0;
						echo "</ol>";
					}
				}
				}
				?>
				<div class="loadpage"><?php echo $pagination; ?></div>
			</div>
		<?php } else {if($_SESSION['config_template']=='layoutmain_web1') { ?>
			<link rel="stylesheet" type="text/css" href="/css/tooltip.css" />
			<script type="text/javascript" src="/js/jquery_elastic.js" language="javascript" ></script>
			<script type="text/javascript" src="/js/tooltip.js" language="javascript" ></script>
			<div class="listing-type-grid catalog-listing">
							<ol class="grid-row">
			<?php  
				$count=0;
				if($getthings!=null)
				{
				foreach ($getthings as $product)
				{
					$count++;
				?>	
								<li class="item">
									<div class="left_cart_img">
										<p class="product-image">
											<a title="<?php echo $product["title"] ?>" href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>">
												<img  src="<?php echo $product["avatar"] ?>" style="max-width: 96px;max-height: 96px;" onMouseover="ddrivetip('<?php echo $product["title"]?>')" onMouseout="hideddrivetip()">
											</a>
										</p>
										<?php if($type==1){ ?>
										<button class="form-button"  type="button" onclick="addCart(<?php echo $product["thing_id"] ?>)">
											<span><?php echo $btnadd ?></span>
										</button>
										<?php } ?>
										</div>
									<div class="right_name_price">
										<h5>
											<a title="<?php echo $product["title"] ?>" href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $product["title"] ?></a>
										</h5>
										<div class="price-box">
											<span id="product-price-51" class="regular-price">
											<?php if($type==1){ ?>
											<span class="price"><?php echo number_format($product["price"]) ?> VNĐ</span>
											<?php } ?>
											</span>
										</div>
										<p class="add-to">
											<a class="link-cart" href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $btndetail ?></a>
											
										</p>
									</div>
								</li>
							<!-- tooltip product -->
                    <div id="<?php echo $product["title"]?>" class="tooltip">
                        <div id="t_p_name">
                            <h3 class="p_name"><?php echo $product["title"]?></h3>
                        </div>
                        <div id="t_p_date">
                            <span class="p_date"><b><?php echo $cdate ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["created_date"])?></span>
                        </div>
                        <div id="t_p_status">
                            <span class="p_update"><b><?php echo $update ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["update_date"])?></span>
                        </div>
                        <div id="t_p_price">
                            <span class="p_price"><?php if($type==1){?><b><?php echo $price ?> </b><?php echo number_format($product["price"])?> VNĐ &nbsp; &nbsp;<?php }?> (<b><?php echo $view ?></b> <?php echo $product["views"]?>)</span>
                        </div>
                        <div id="t_p_picture" >
                        	<img src="<?php echo $product['avatar']?>" alt="" class="t_p_avatar"/>
                        </div>
                        <div id="t_pt_short_description" >
                        	<span class="p_short_description"><?php echo nl2br($product['short_description'])?></span>
                        </div>
					</div>
                    <!-- end tooltip product -->
				<?php 
					if($count==3)
					{
						$count=0;
						echo"</ol><ol class='grid-row'>";
					}
				}
				}
				?>	
								
							</ol>
						</div>
			<div style="border-bottom:1px solid #cacaca;width:100%"></div>
		<?php } else{?>
			<link rel="stylesheet" type="text/css" href="/css/tooltip.css" />
			<script type="text/javascript" src="/js/jquery_elastic.js" language="javascript" ></script>
			<script type="text/javascript" src="/js/tooltip.js" language="javascript" ></script>
					<div style="clear:both;text-align:center;font-size:12px;color:red"><?php echo $errorMessage;?></div>
			<div class="c_r_row">
				<?php  
				$count=0;
				if($getthings!=null)
				{
				foreach ($getthings as $product)
				{
					$count++;
				?>	
					<!--column product-->
					<div class="pro_col">
						<div class="pro_col_top" >
							<div class="pro_col_name">
								<a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('<?php echo $product["title"]?>')" onMouseout="hideddrivetip()"><h2><?php echo $product["title"]?></h2></a>
                            </div>
                            <div class="pro_col_img">
                            	<a href="/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('<?php echo $product["title"]?>')" onMouseout="hideddrivetip()"><img src="<?php echo $product['avatar']?>" alt="" class="pro_img"/></a>
							</div>
						</div>
						<div class="pro_col_content">
                        </div>
		  				<div class="pro_col_bottom">
		  					<div class="pro_col_price">
		  						<?php if($type==1){?><b class="pro_price"><?php echo number_format($product["price"])?> VNĐ</b><?php }?>
		  					</div>
							<div class="pro_col_button">
								<input type="button" name="btnDetails" style="background-image: url('../images/but_details2.png');color:white; border: none;text-align: center;" value="<?php echo $btndetail ?>" class="btnDetail" onclick="document.location.href='/<?php echo $route;?>/detail?id=<?php echo $product["thing_id"] ?>'" <?php if($type!=1){?>style="margin-left: 50px;"<?php }?>/>
								<?php if($type==1){?><input type="button" name="btnAdd" style="background-image: url('../images/but_addtocart2.png');color:white; border: none;text-align: center;margin-left:10px" value="<?php echo $btnadd ?>" class="btnAdd" onclick="addCart(<?php echo $product["thing_id"] ?>)"/><?php }?>
							</div>
						</div>
					</div><!--end column product-->
					
					<!-- tooltip product -->
                    <div id="<?php echo $product["title"]?>" class="tooltip">
                        <div id="t_p_name">
                            <h3 class="p_name"><?php echo $product["title"]?></h3>
                        </div>
                        <div id="t_p_date">
                            <span class="p_date"><b><?php echo $cdate ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["created_date"])?></span>
                        </div>
                        <div id="t_p_status">
                            <span class="p_update"><b><?php echo $update ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["update_date"])?></span>
                        </div>
                        <div id="t_p_price">
                            <span class="p_price"><?php if($type==1){?><b><?php echo $price ?> </b><?php echo number_format($product["price"])?> VNĐ &nbsp; &nbsp;<?php }?> (<b><?php echo $view ?></b> <?php echo $product["views"]?>)</span>
                        </div>
                        <div id="t_p_picture" >
                        	<img src="<?php echo $product['avatar']?>" alt="" class="t_p_avatar"/>
                        </div>
                        <div id="t_pt_short_description" >
                        	<span class="p_short_description"><?php echo nl2br($product['short_description'])?></span>
                        </div>
					</div>
                    <!-- end tooltip product -->
					
				<?php 
					if($count==3)
					{
						$count=0;
						echo"</div><div class='c_r_row' >";
					}
				}
				}
				?>	
				</div><!--end c_r_row-->
				
				<div class="loadpage"><?php echo $pagination; ?></div>
		<?php }} ?>
				<!-- minh if else muti layout trong day-->
		<?php } ?>
		<div style="clear: both;"></div>
		<script type="text/javascript">

function popUnder(url)
{
var w = 800;
var h = 600;
props = "width=" + w + ",";
props += "height=" + h + ",";
props += "titlebar=0,";
props += "toolbar=0,";
props += "location=0,";
props += "menubar=0," ;
props += "scrollbars=1," ;
props += "resizable=0," ;
props += "channelmode=0," ;
props += "directories=0," ;
props += "status=0";

var popwin = window.open("","popwin",props,true);
popwin.location = url ;

self.focus();

}
</SCRIPT>